The Battle of Gaoliang River was fought in 979 between the Liao Dynasty and Song Dynasty in what is today the city of Beijing. The Liao victory ended a Song campaign to recapture the Sixteen Prefectures in North China.
After founding the Song Dynasty in 960, Emperor Taizong sought to recapture the sixteen prefectures, which the Khitan Liao Dynasty acquired in 936. Song Emperor Taizong personally led a military expedition that reached Youzhou in 979, and laid siege to the city. The city's walls, some 16 km in circumference withstood the siege for three months. Defenders were bolstered by Khitan reinforcements who were able burrow under the Song siege and into the city itself. A large Liao reinforcement arrived and defeated the Song Army north of Youzhou, just west of Xizhimen, in present-day Beijing.[1]
More than 160 years after this defeat, the Song briefly took control of modern day Beijing in 1123 when the Song-Jin Alliance defeated the Liao and the city was ceded by the Jin Dynasty to the Song. However, two years later, the Jin invaded the Song and retook Yanshan.